SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE procedure dbo.DnnProduct_GetLinks

@ModuleId int

as

select DnnProduct_Links.ItemId,
       DnnProduct_Links.ModuleId,
       DnnProduct_Links.CreatedByUser,
       DnnProduct_Links.CreatedDate,
       DnnProduct_Links.Title,
       DnnProduct_Links.URL,
       DnnProduct_Links.ViewOrder,
       DnnProduct_Links.Description,
       DnnProduct_UrlTracking.TrackClicks,
       DnnProduct_UrlTracking.NewWindow
from   DnnProduct_Links
left outer join DnnProduct_UrlTracking on DnnProduct_Links.URL = DnnProduct_UrlTracking.Url and DnnProduct_UrlTracking.ModuleId = @ModuleID 
where  DnnProduct_Links.ModuleId = @ModuleId
order by DnnProduct_Links.ViewOrder, DnnProduct_Links.Title

GO
